﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package validation.util {
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import flash.utils.*;
    import validation.*;
    import Mechanics.GameEventMechanics.*;

    public class RollCallValidationUtil implements IValidationUtilClass {

        protected var m_validators:Dictionary;

        public function RollCallValidationUtil(){
            this.loadValidators();
        }
        public function getValidationCallback(_arg1:String):Function{
            return (this.m_validators[_arg1]);
        }
        protected function loadValidators():void{
            this.m_validators = new Dictionary();
            this.m_validators["canPerformRollCall"] = function (_arg1:Object):Boolean{
                var _local2:IGameMechanic = MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all");
                return ((((_local2 is RollCallDataMechanic)) && ((_local2 as RollCallDataMechanic).canPerformRollCall())));
            };
            this.m_validators["rollCallProgressLessThan"] = function (_arg1:Object):Boolean{
                var _local2:RollCallDataMechanic = (MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all") as RollCallDataMechanic);
                var _local3:Number = _arg1.value;
                return (((_local2) && ((_local2.getRollCallTimeLeft() < _local3))));
            };
            this.m_validators["rollCallProgressGreaterThan"] = function (_arg1:Object):Boolean{
                var _local2:RollCallDataMechanic = (MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all") as RollCallDataMechanic);
                var _local3:Number = _arg1.value;
                return (((_local2) && ((_local2.getRollCallTimeLeft() > _local3))));
            };
            this.m_validators["isRollCallComplete"] = function (_arg1:Object):Boolean{
                var _local2:IGameMechanic = MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all");
                return ((((_local2 is RollCallDataMechanic)) && ((_local2 as RollCallDataMechanic).isRollCallComplete())));
            };
            this.m_validators["isActiveObject"] = function (_arg1:Object):Boolean{
                var _local2:IGameMechanic = MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all");
                return ((((_local2 is RollCallDataMechanic)) && ((_local2 as RollCallDataMechanic).isActiveObject())));
            };
            this.m_validators["isNotActiveObject"] = function (_arg1:Object):Boolean{
                var _local2:IGameMechanic = MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all");
                return (!((((_local2 is RollCallDataMechanic)) && ((_local2 as RollCallDataMechanic).isActiveObject()))));
            };
            this.m_validators["canCheckIn"] = function (_arg1:Object):Boolean{
                var _local2:String = (_arg1.zid) ? _arg1.zid : Global.player.uid;
                var _local3:RollCallDataMechanic = (MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all") as RollCallDataMechanic);
                return (((_local3) && (_local3.canCheckIn(_local2))));
            };
            this.m_validators["canCollect"] = function (_arg1:Object):Boolean{
                var _local4:RollCallDataMechanic;
                var _local2:Boolean;
                var _local3:IGameMechanic = MechanicManager.getInstance().getMechanicInstance((this as IMechanicUser), "rollCall", "all");
                if ((_local3 is RollCallDataMechanic)){
                    _local4 = (_local3 as RollCallDataMechanic);
                    _local2 = _local4.canCollect(Global.player.uid);
                };
                return (_local2);
            };
        }

    }
}//package validation.util 
